<template>
	<div class="recharge">	 
		<TopWithLeft></TopWithLeft>
		<div class="recharge_top_local" @click="openCity">
      <div class="recharge_top_local_icon"><img src="./../../assets/images/location_blue_icon.png"></div>
      <div class="recharge_top_local_m">当前位置：洛阳</div>
      <div class="recharge_top_local_go_icon"><img src="./../../assets/images/go.png"></div>
    </div>
    <div class="devivid"></div>
    <div class="recharge_money_box">
      <p>账户当前余额：{{amount_info.amount}}元</p>
      <input type="text" placeholder="请输入充值金额">
    </div>
    <div class="recharge_money_card">
      <p class="recharge_money_card_header">充值</p>
      <ul class="recharge_money_card_ul">
        <li v-for="(item,index) of chargeActivities">
          <p>{{item.recharge}}元</p>
          <span v-if="item.return_amount>0">送{{item.return_amount}}金币</span>
        </li>
      </ul>
    </div>
    <button class="recharge_btn">充值</button>
    <button class="rechargecard_btn">使用充值卡充值</button>
  </div>
</template>
<script>
import TopWithLeft from './../common/TopWithLeft.vue'
import { rechargeActivites } from '@/api/allapis'
import { getInfo } from '@/api/login'
export default{
  name: 'Recharge',
  data() {
    return{
        chargeActivities:'',//充值活动
        datalist:'',//全部信息
        member_info:'',//个人信息
        amount_info:{},//账户信息
    }
  },
  methods:{
    //拉取个人信息
    loadInfoMessage(){
      getInfo().then(response=>{
          console.log(JSON.stringify(response)  )
          this.member_info = response.data.member_info
          if(response.data.amount_info!==null){
            this.amount_info = response.data.amount_info
          }else{
            this.amount_info.amount='0.00'
            // console.log(JSON.stringify(this.amount_info.amount))
          }
          this.datalist = response.data
      })
    },
    //拉取该区域活动信息
    loadActivities(){
      rechargeActivites().then(response=>{
        this.chargeActivities = response.data.rebatelist
      })
    },
    //打开城市切换页
    openCity(){
      this.$router.push({
        name:'City'
      })
    },
  },
  created(){
    this.loadInfoMessage()
    this.loadActivities()
  },
  components:{
  	TopWithLeft
  }
}
</script>
<style scoped>
.recharge{padding-top:50px;}
</style>


